﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Graphics;

namespace Projeto__A_Cura.Scenes
{
    class Scene05 : BaseScene
    {
        public Scene05(SceneManager.Scenes thisScene)
            : base(thisScene) { }

        public override void LoadContent(ContentManager Content)
        {
            audio01 = Content.Load<Song>(contentDir + "R1");
            description = "Beleza a caixa...";
        }

        public override void Update(
            KeyboardState keyboard,
            KeyboardState old_keyboard,
            GameTime gameTime,
            SceneManager.Scenes actualScene)
        {
            //keyboard = Keyboard.GetState();

            //if (actualScene == thisScene)
            //{
            if (!wasAudio01Played)
            {
                MediaPlayer.Play(audio01);
                wasAudio01Played = true;
            }

            if ((MediaPlayer.State == MediaState.Stopped)
                    || (SceneManager.DEBUG))
            {
                if (keyboard.IsKeyDown(Keys.Space) && !old_keyboard.IsKeyDown(Keys.Space))//repetir
                {
                    wasAudio01Played = false;
                    //SceneManager.lastScene = actualScene;
                    SceneManager.actualScene = thisScene;
                }

                if (keyboard.IsKeyDown(Keys.Down) && !old_keyboard.IsKeyDown(Keys.Down))//voltar... audio 1 cena 2
                {
                    wasAudio01Played = false;
                    SceneManager.lastScene = thisScene;
                    SceneManager.actualScene = SceneManager.Scenes.SCENE02;
                }

                if (keyboard.IsKeyDown(Keys.Left) && !old_keyboard.IsKeyDown(Keys.Left))
                //&& thisScene != SceneManager.actualScene)//audio 2 fase 2
                {
                    wasAudio01Played = false;
                    SceneManager.lastScene = thisScene;
                    SceneManager.actualScene = SceneManager.Scenes.SCENE07;
                }
            }
        }

        //old_keyboard = keyboard;
    }
}
